# -*- coding: UTF-8 -*-

import pypinyin


# 不带声调的(style=pypinyin.NORMAL)
def pinyin(word):
    s = ''
    for i in pypinyin.pinyin(word, style=pypinyin.NORMAL):
        s += ''.join(i)
    return s

# 不带声调的(style=pypinyin.NORMAL)
def pinyins(word):
    array = []
    for i in pypinyin.pinyin(word, style=pypinyin.NORMAL):
        array.append(''.join(i))
    return array

# 带声调的(默认)
def yinjie(word):
    s = ''
    # heteronym=True开启多音字
    for i in pypinyin.pinyin(word, heteronym=True):
        s = s + ''.join(i) + " "
    return s


if __name__ == "__main__":
    print(pinyin("忠厚传家久"))
    print(pinyins("忠厚传家久"))
    print(yinjie("诗书继世长"))
